/*
   @Copyright:LeetCode
   @Author:   tjyemail
   @Problem:  http://leetcode.com/problems/container-with-most-water
   @Language: C++
   @Datetime: 19-05-22 11:52
   */

class Solution {
public:
	int maxArea(vector<int>& height) {
		int area=0;
		for(int i=0, j=height.size()-1; i<j;){
			area=max(area,min(height[i],height[j])*(j-i));
			height[i]<height[j]?++i:--j;
		}
		return area;
	}
};
